package com.lu.sb210207.task;

import com.lu.sb210207.entity.ScheduleTriggerParam;
import com.lu.sb210207.mapper.ScheduleTriggerParamMapper;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

@Component
@Slf4j
public class MyJob3 implements Job {

    @Autowired
    private ScheduleTriggerParamMapper scheduleTriggerParamMapper;

    //获取spring 上下文的Bean
    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        System.out.println("这是一个获取sprig中Bean的job任务" + new Date().toLocaleString());

        List<ScheduleTriggerParam> scheduleTriggerParams =
                scheduleTriggerParamMapper.queryScheduleParams(2);
        System.out.println("参数数量" + scheduleTriggerParams.size());
    }

}
